package utils.sl651;

import lombok.Data;

/**
 * SL651自定义元素标签类
 * 用于定义和存储自定义数据元素的解析规则
 */
@Data
public class SL651CustomElementLabel {
    private String label;      // 标识符（如fe30）
    private String remark;     // 备注（如第一通道渗压水位）
    private String highByte;   // 高字节
    private String lowByte;    // 低字节
    private String elementName; // 元素名称
    private String unit;       // 单位
    
    public SL651CustomElementLabel(String label, String remark, String highByte, String lowByte, String elementName, String unit) {
        this.label = label;
        this.remark = remark;
        this.highByte = highByte;
        this.lowByte = lowByte;
        this.elementName = elementName;
        this.unit = unit;
    }

    public String getHighByte() {
        if (null != label) {
            return label.substring(0, 2);
        }
        return highByte;
    }

    public String getLowByte() {
        if (null != label) {
            return label.substring(2, 4);
        }
        return lowByte;
    }

    
    @Override
    public String toString() {
        return "SL651CustomElementLabel{" +
                "label='" + label + '\'' +
                ", remark='" + remark + '\'' +
                ", highByte='" + highByte + '\'' +
                ", lowByte='" + lowByte + '\'' +
                ", elementName='" + elementName + '\'' +
                ", unit='" + unit + '\'' +
                '}';
    }
}